#include<16f877a.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
//#use delay(clock=20000000)
#use delay(clock=11592000)

#define HIGH 1
#define LOW 0
#define MOT1 PIN_C0//ir sensor
#define MOT2 PIN_C1//ir sensor
#define MOT3 PIN_C2
#define MOT4 PIN_C3
#define MOT3 PIN_C4
#define MOT4 PIN_C5
#define MOT3 PIN_C6
#define MOT4 PIN_C7


void forward()
 {
output_bit(MOT1,HIGH);
output_bit(MOT2,LOW);
output_bit(MOT3,LOW);
output_bit(MOT4,HIGH);
 }
void reverse()

 {
output_bit(MOT1,LOW);
output_bit(MOT2,HIGH);
output_bit(MOT3,HIGH);
output_bit(MOT4,LOW);
 }
/*void turn_left()
 {
output_bit(MOT1,LOW);
output_bit(MOT2,HIGH);
output_bit(MOT3,LOW);
output_bit(MOT4,LOW);
 }
void turn_right()
{
output_bit(MOT1,LOW);
output_bit(MOT2,LOW);
output_bit(MOT3,HIGH);
output_bit(MOT4,LOW);
}*/
void stop()
 {
output_bit(MOT1,LOW);
output_bit(MOT2,LOW);
output_bit(MOT3,LOW);
output_bit(MOT4,LOW);
 }

void main()
{
   init_lcd();
   unsigned char sw;
   port_b_pullups(true);
   output_c(0x00);
   //output_b(0x00);

   while(1)
   {
 //  sw=input_B();

   /*if(input(PIN_B0))
 {
   forward();

  // output_C(0xAA);//front
    delay_ms(100);
   output_c(0x00);
 //  forward();

   }
    if(input(PIN_B1))
  {
    reverse();
   //output_C(0x55);//back
    delay_ms(100);
   output_c(0x00);
   }*/
    if(input(PIN_B3)==0)
  {
   display("Over Load");
   delay_ms(100); 
   }
    /*else if(input(PIN_B2)==0)
   {
   reverse();//turn_right();
 //  reverse();
  // output_C(0x66);//left
   delay_ms(100);
   //output_c(0x00);

   }
   else if(input(PIN_B1)==0)
   {
   stop();
   delay_ms(100);
   }
*/
   }
}
